Repository navigation
fix(realtime): scope batch-add upserts to the caller's workflow - #8894
Conversation
Block, edge, and subflow ids are global primary keys, so the ON CONFLICT (id) DO UPDATE in batch-add-blocks and batch-add-edges could overwrite a row owned by another workflow. Route every upsert through upsertWorkflowRows, which confines the update to the socket's workflow with setWhere and aborts the transaction when RETURNING shows a skipped conflict.
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
There was a problem hiding this comment.
No issues found across 1 file
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
Heads up: you’ve reached your flex budget. Increase your flex budget or wait for usage to reset.
Turn on auto-fix | Re-trigger cubic
|
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
There was a problem hiding this comment.
No issues found across 1 file
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
Heads up: you’ve reached your flex budget. Increase your flex budget or wait for usage to reset.
Turn on auto-fix | Re-trigger cubic
Summary
ON CONFLICT (id) DO UPDATEinbatch-add-blocks/batch-add-edgescould update a row that belongs to a different workflow than the socket'supsertWorkflowRows:setWhere: workflow_id = <socket workflow>confines the update to the caller's workflow, and aRETURNING idcount check aborts the transaction when a conflict was skipped instead of dropping rows silentlyType of Change
Testing
persistWorkflowOperation: block, edge, and loop ids owned by another workflow are rejected and the other workflow's rows are unchanged; a rejected batch commits none of its own rows; a normal add plus a same-workflow re-add still works. On the pre-fix code all six cross-workflow checks fail (other workflow's rows overwritten)apps/realtimetype-check, biome,src/databasevitestChecklist
test-auditauthoring gate)